Skip to content

Conversation

@zamoore
Copy link
Contributor

@zamoore zamoore commented Nov 17, 2025

πŸ“Œ Summary

Fixed a race condition in HdsAdvancedTable where re-rendering the table via updating the @model argumentcaused the internal state of selectable rows to be incorrectly wiped out.

πŸ› οΈ Detailed description

The Problem

When the table@model updates, it inserts the new DOM elements before destroying the old ones. This creates a momentary overlap where this._selectableRows contains two entries for the same row (the stale instance and the fresh instance) sharing the same selectionKey.

Previously, the willDestroyRowCheckbox method used .filter() to remove the row being destroyed. Because the old and new rows shared the same selectionKey during this overlap window, the filter logic aggressively removed both entries. This left the internal tracking array empty.

The Solution

Replaced the .filter() logic with a more targeted .findIndex() and .splice() approach.

Find: We locate the first index matching the selectionKey (which corresponds to the old row).

Splice: We remove exactly one item at that index.

The Results

This change ensures that during the lifecycle overlap, we only remove the stale DOM reference while keeping the newly inserted row intact. The cleanup now correctly leaves one valid entry remaining, preserving the integrity of the selection state.

πŸ”— External links

Jira ticket: HDS-5636


πŸ‘€ Component checklist

πŸ’¬ Please consider using conventional comments when reviewing this PR.

πŸ“‹ PCI review checklist
  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
  • If applicable, I've worked with GRC to document the impact of any changes to security controls.
    Examples of changes to controls include access controls, encryption, logging, etc.
  • If applicable, I've worked with GRC to ensure compliance due to a significant change to the in-scope PCI environment.
    Examples include changes to operating systems, ports, protocols, services, cryptography-related components, PII processing code, etc.

@vercel
Copy link

vercel bot commented Nov 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
hds-showcase Ready Ready Preview Dec 1, 2025 7:57pm
hds-website Ready Ready Preview Dec 1, 2025 7:57pm

@zamoore zamoore marked this pull request as ready for review December 1, 2025 19:52
@zamoore zamoore requested a review from a team as a code owner December 1, 2025 19:52
@zamoore zamoore merged commit b325da9 into main Dec 5, 2025
15 checks passed
@zamoore zamoore deleted the zamoore/5636/AdvancedTable-selectable-rows-spike branch December 5, 2025 18:16
@hashibot-hds hashibot-hds mentioned this pull request Dec 5, 2025
@zamoore zamoore added this to the 5.1.0 milestone Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants